package com.dragon.modules.yuegou.service.impl.member;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dragon.modules.yuegou.entity.member.InterestEntity;
import com.dragon.modules.yuegou.enums.code.MemberCode;
import com.dragon.modules.yuegou.mapper.member.InterestMapper;
import com.dragon.modules.yuegou.model.member.Interest;
import com.dragon.modules.yuegou.service.member.InterestService;
import com.dragon.modules.yuegou.web.Check;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * 会员兴趣爱好 服务实现
 *
 * @author pbuilder generated
 * @date 2019-06-14 09:37:04
 * @version 2.0
 */
@Service("memInterestService")
public class InterestServiceImpl
		extends ServiceImpl<InterestMapper, InterestEntity>
		implements InterestService {

	@Override
	public void saveInterest(String interest,String memberId) {
		Check.notNull(memberId, MemberCode.MEMBER_ID_IS_EMPTY.getMessage());
		Check.notNull(interest, "商品类别标签不能为空");
		String[] split = interest.split(",");
		for (String rest : split) {
			if (StringUtils.isNotBlank(rest)) {
				Interest interes = new Interest();
				interes.setMemberId(memberId);
				interes.setInterest(rest);
				save(interes);
			}
		}
	}

}